<?php
use yii\web\View;
use yii\widgets\ActiveForm;
use yii\widgets\LinkPager;
/* @var $this yii\web\View */
/* @var $model common\models\User */
$this->registerJsFile('/js/jquery.SuperSlide.2.1.1.js');
$this->registerJsFile('/js/common_js.js', [
    'position' => View::POS_BEGIN
]);
$this->registerCssFile('/css/common.css');
$this->registerCssFile('/fonts/iconfont.css');
$this->registerJsFile('/js/public.js');
$this->registerCssFile('/css/myorder.css');
$this->registerJsFile('/layer/layer.js');
$this->title = '订单列表-锐锋堂刀剑网';
?>
<?php $this->beginBlock('fulfil');?>
function fulfil(id,obj){
layer.confirm('是否确认收货？', {
  btn: ['确认','取消'] //按钮
}, function(){
  
	$.ajax({
	type:'get',
	url:'/user/fulfil.html?id='+id,
	dataType:'json',
	success:function(data){
	if(data){
	layer.msg('操作成功');
	$(obj).parent().prev().html('<p style="color:#F30">交易已成功</p><p style="color:#CCC">未评价</p>');
	$(obj).after('<a href="javascript:;" onclick="assess('+id+',this)">立即评价</a>');
	$(obj).remove();
	}else{
	layer.msg('操作失败,您可刷新页面重试');
	}
		}
	});
});
}
function assess(id,obj){
layer.msg('功能完善中');
}
<?php $this->endBlock()?>
<?php $this->registerJs($this->blocks['fulfil'],View::POS_END)?>
<div class="title_style">
	<em></em>订单管理
</div>
<div class="Order_form_style">
	<div class="Order_form_filter">
		<a href="?" <?php if($_GET['name']===null):?>class="on"<?php endif;?>>全部订单</a> 
		<a href="?name=0" <?php if($_GET['name']=='0'):?>class="on"<?php endif;?>>待付款（<?=$status[0]?$status[0]:0?>）</a> 
		<a href="?name=1" <?php if($_GET['name']==1):?>class="on"<?php endif;?>>代发货（<?=$status[1]?$status[0]:0?>）</a> 
		<a href="?name=2" <?php if($_GET['name']==2):?>class="on"<?php endif;?>>待收货（<?=$status[2]?$status[0]:0?>）</a> 
		<a href="?name=3" <?php if($_GET['name']==3):?>class="on"<?php endif;?>>退货/退款</a> 
		<a href="?name=4" <?php if($_GET['name']==4):?>class="on"<?php endif;?>>交易成功</a> 
		<a href="?name=5" <?php if($_GET['name']==5):?>class="on"<?php endif;?>>交易关闭</a>
	</div>
	<div class="Order_Operation">
		<div class="left">
			<label><input name="" type="checkbox" value="" class="checkbox" />全选</label>
			<input name="" type="submit" value="批量确认收货" class="confirm_Order" />
		</div>
		<div class="right_search">
		<?php ActiveForm::begin(['method'=>'get'])?>
			<input name="search" type="text" class="add_Ordertext"
				placeholder="请输入产品标题或订单号进行搜索" /><input name="" type="submit"
				value="搜索订单" class="search_order" />
		<?php ActiveForm::end()?>
		</div>
	</div>
	<div class="Order_form_list">
		<table>
			<thead>
				<tr>
					<td class="list_name_title0">商品</td>
					<td class="list_name_title1">单价(元)</td>
					<td class="list_name_title2">数量</td>
					<td class="list_name_title4">实付款(元)</td>
					<td class="list_name_title5">订单状态</td>
					<td class="list_name_title6">操作</td>
				</tr>
			</thead>
			<?php if(!empty($order)):?>
			<?php foreach($order as $val):?>
			<tbody>
				<tr class="Order_info">
					<td colspan="6" class="Order_form_time"><input name=""
						type="checkbox" value="" class="checkbox" />
						订单号：<?=$val['omun']?> | 下单时间：<?=date('Y-m-d H:i:s',$val['create_at'])?><em></em></td>
				</tr>
				<tr class="Order_Details">
					<td colspan="3">
						<table class="Order_product_style">
							<tbody>
							<?php if(!empty($val['oinfo'])):?>
							<?php foreach($val['oinfo'] as $v):?>
								<tr>
									<td>
										<div class="product_name clearfix">
											<a href="#" class="product_img"><img src="<?=$v['logo']?>"
												width="80px" height="80px"></a> <a href="/goods/view-<?=$v['gid']?>.html" class="p_name"><?=$v['name']?></a>
											<p class="specification"><?=$v['num']?>/把</p>
										</div>
									</td>
									<td><?=$v['price']?></td>
									<td><?=$v['num']?></td>
								</tr>
							<?php endforeach;?>
							<?php endif;?>
							</tbody>
						</table>
					</td>
					<td class="split_line"><?=$val['price']?></td>
					<?php switch ($val['status']){
                        case 0:echo '<td class="split_line">等待买家付款</td>';break;
                        case 1:echo '<td class="split_line"><p style="color: #F33">买家已付款</p></td>';break;
                        case 2:echo '<td class="split_line"><p style="color: #F30">已发货，待收货</p></td>';break;
                        case 3:echo '<td class="split_line"><p style="color:#F30">交易已成功</p><p style="color:#CCC">未评价</p></td>';break;
                        case 4:echo '<td class="split_line"><p style="color:#F30">交易已成功</p><p style="color:#999">已评论</p></td>';break;
					}
                        ?>
					<td class="operating">
					<?php if($val['status']==2):?>
					<a href="javascript:;" onclick="fulfil(<?=$val['id']?>,this)">确认收货</a>
					<?php elseif($val['status']==3):?>
					<a href="javascript:;" onclick="assess(<?=$val['id']?>,this)">立即评价</a>
					<?php endif;?>
					<a method='post' href="/user/odetail.html?id=<?=$val['omun']?>">查看订单</a>
					<?php if($val['status']==0):?><a href="/goods/pay.html?id=<?=$val['omun']?>" method='post'>立即付款</a><?php endif;?>
					<a href="#">删除</a></td>
				</tr>
			</tbody>
			<?php endforeach;?>
			<?php endif;?>
		</table>
	</div>
	<div class='Inside_pages'>
					<div class="Pagination">
						<?= LinkPager::widget([ 
    'options'=>['class'=>'Paging'],
    'pagination' => $pages, 
	'firstPageLabel' => '首页',
	'lastPageLabel' => '尾页',
    'nextPageLabel' => '下一页', 
    'prevPageLabel' => '上一页',
    'maxButtonCount'=>4
]); ?>
			</div>
					</div>
</div>